package cn.tedu.spring.eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class ShopController {
    private String name;

    public ShopController(){
        System.out.println("1.实例化阶段调用无参构造方法");
    }
@Value("买东西")
    public void setName(String name) {
        this.name = name;
    System.out.println("2.依赖注入阶段，调用set方法");
    }
    @PostConstruct
    public void show(){
        System.out.println("3.生命周期的初始化方法");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("5.生命周期的销毁方法");
    }
}
